
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.datadump.biz.convertor.*;
import com.joysuch.wwyt.datadump.biz.processor.MajorHazardImportProcessor;
import com.joysuch.wwyt.datadump.biz.processor.MhChemProductImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.MhChemProductDumpQueryBean;
import com.joysuch.wwyt.mh.entity.dsl.QMhMajorHazardChemProduct;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@DataDumpEntity(name = "mh-chem-product-dump", entity = QMhMajorHazardChemProduct.class, exportQueryConditions = MhChemProductDumpQueryBean.class,
        businessName = "危险化学品", batchDeleteField = "state", deleteFlagValue = "44", importProcessors = MhChemProductImportProcessor.class)
@Data
public class MhChemProductDumpBean {

    @NotNull
    @Length(max = 64)
    @Excel(name = "危化品编号", width = 15)
    @DataDumpField(field = "code", importKey = true)
    private String code;

    @NotNull
    @Length(max = 64)
    @Excel(name = "危化品名称", width = 25)
    @DataDumpField(field = "name")
    private String name;

    @NotNull
    @Length(max = 64)
    @Excel(name = "CAS号", width = 20)
    @DataDumpField(field = "casNo")
    private String casNo;

    @javax.validation.constraints.NotNull
    @Pattern(regexp="是|否" , message = "只能填写以下内容" + "\"是|否\"")
    @Excel(name = "是否重点监管危险化学品", width = 20)
    @DataDumpField(field = "hazardChemicalFlag", exportConvertors = { ExportYesNoConvertor.class }, importConvertors = ImportYesNoToStringIntConvertor.class)
    private String hazardChemicalFlag;

    @Length(max = 64)
    @Excel(name = "别名")
    @DataDumpField(field = "alias")
    private String alias;

    @Length(max = 64)
    @Excel(name = "英文名称", width = 25)
    @DataDumpField(field = "engName")
    private String engName;

    @Length(max = 512)
    @Excel(name = "危险性类别", width = 40)
    @DataDumpField(field = "type")
    private String type;

    @Pattern(regexp = "产品|中间产品|进口化学品|原料" , message = "只能填写以下内容" + "\"产品|中间产品|进口化学品|原料\"")
    @Excel(name = "化学品类型", width = 40)
    @DataDumpField(field = "chemProductType", exportConvertors = ExportMhChemProudctProductTypeConvertor.class, importConvertors = ImportMhChemProudctProductTypeConvertor.class)
    private String chemProductType;

    @Pattern(regexp = "原料|中间产物|产品|副产品" , message = "只能填写以下内容" + "\"原料|中间产物|产品|副产品\"")
    @Excel(name = "作用", width = 20)
    @DataDumpField(field = "functions", exportConvertors = ExportMhChemProudctFunctionConvertor.class, importConvertors = ImportMhChemProudctFunctionConvertor.class)
    private String functions;

    @Length(max = 12, message = "长度不超12位数字(含小数点)")
    @Pattern(regexp = "\\d{1,9}(\\.\\d{1,2})?", message = "不超过12位数字，小数点不超过2位数字")
    @Excel(name = "最大存储量（吨）", width = 20)
    @DataDumpField(field = "max")
    private String max;

    @Length(max = 12, message = "长度不超12位数字(含小数点)")
    @Pattern(regexp = "\\d{1,9}(\\.\\d{1,2})?", message = "不超过12位数字，小数点不超过2位数字")
    @Excel(name = "年产品生产能力（吨）", width = 20)
    @DataDumpField(field = "yearlyProductionCapacity")
    private String yearlyProductionCapacity;

    @Length(max = 12, message = "长度不超12位数字(含小数点)")
    @Pattern(regexp = "\\d{1,9}(\\.\\d{1,2})?", message = "不超过12位数字，小数点不超过2位数字")
    @Excel(name = "年产品生产能力气体（方）", width = 20)
    @DataDumpField(field = "gasYearlyProductionCapacity")
    private String gasYearlyProductionCapacity;

    @Length(max = 12, message = "长度不超12位数字(含小数点)")
    @Pattern(regexp = "\\d{1,9}(\\.\\d{1,2})?", message = "不超过12位数字，小数点不超过2位数字")
    @Excel(name = "年产品最大储量（吨）", width = 20)
    @DataDumpField(field = "yearlyMax")
    private String yearlyMax;

    @Length(max = 12, message = "长度不超12位数字(含小数点)")
    @Pattern(regexp = "\\d{1,9}(\\.\\d{1,2})?", message = "不超过12位数字，小数点不超过2位数字")
    @Excel(name = "年产品最大储量气体（方）", width = 20)
    @DataDumpField(field = "gasYearlyMax")
    private String gasYearlyMax;

    @Length(max = 50)
    @Excel(name = "存储地点/方式", width = 20)
    @DataDumpField(field = "storageType")
    private String storageType;


}
